package cn.com.headfree.vo.simple;

import cn.com.headfree.util.SysDictionaryUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang.StringUtils;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class YearEffectInfoVo {

    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    /**
     * 人资编号
     */
    private String erpNo;
    /**
     * 身份证号
     */
    private String idCardNo;
    /**
     * * 评级开始
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date rateYearStart;

    private String rateYearStartStr;

    /**
     * 评级结束
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date rateYearEnd;

    private String rateYearEndStr;

    /**
     * 评级年度
     */
    private Integer rateYear;

    /**
     * 绩效等级
     */
    private String perforGrade;
    /**
     * 剩余积分
     */
    private Double resiInte;

    private String resiInteStr;

    /**
     * 本年度已获取积分
     */
    private Double curInte;

    private String curInteStr;

    /**
     * 创建者id
     */
    private String createrId;
    /**
     * 创建者姓名
     */
    private String createrName;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    /**
     * 更新者id
     */
    private String updaterId;
    /**
     * 更新者姓名
     */
    private String updaterName;
    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;
    /**
     * 0:未删除1：已删除
     */
    private Integer delSign;
    /**
     * 是否有效数据(0:有效，1:无效)
     */
    private Integer isValid;
    /**
     * 审核状态
     */
    private Integer auditState;

    /**
     * 姓名
     */
    private String userName;

    private String id;

    public String getRateYearStartStr() {
        return rateYearStartStr;
    }

    public void setRateYearStartStr(String rateYearStartStr) {
        if (StringUtils.isNotBlank(rateYearStartStr)) {
            this.rateYearStartStr = rateYearStartStr.split(" ")[0];
        } else {
            this.rateYearStartStr = rateYearStartStr;
        }
    }

    public String getRateYearEndStr() {
        return rateYearEndStr;
    }

    public void setRateYearEndStr(String rateYearEndStr) {
        if (StringUtils.isNotBlank(rateYearEndStr)) {
            this.rateYearEndStr = rateYearEndStr.split(" ")[0];
        } else {
            this.rateYearEndStr = rateYearEndStr;
        }
    }

    public Integer getRateYear() {
        return rateYear;
    }

    public void setRateYear(Integer rateYear) {
        this.rateYear = rateYear;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getErpNo() {
        return erpNo;
    }

    public void setErpNo(String erpNo) {
        this.erpNo = erpNo;
    }

    public String getIdCardNo() {
        return idCardNo;
    }

    public void setIdCardNo(String idCardNo) {
        this.idCardNo = idCardNo;
    }

    public Date getRateYearStart() {
        return rateYearStart;
    }

    public void setRateYearStart(Date rateYearStart) {
        this.rateYearStart = rateYearStart;
        if (rateYearStart != null) {
            this.rateYearStartStr = sdf.format(rateYearStart).split(" ")[0];
        }
    }

    public Date getRateYearEnd() {
        return rateYearEnd;
    }

    public void setRateYearEnd(Date rateYearEnd) {
        this.rateYearEnd = rateYearEnd;
        if (rateYearEnd != null) {
            this.rateYearEndStr = sdf.format(rateYearEnd).split(" ")[0];
        }
    }

    public String getPerforGrade() {
        return perforGrade;
    }

    public void setPerforGrade(String perforGrade) {
        this.perforGrade = perforGrade;
//        this.perforGrade = SysDictionaryUtil.getNameByValue("PerformLevelRecentThreeYears",perforGrade);;
    }

    public Double getResiInte() {
        return resiInte;
    }

    public void setResiInte(Double resiInte) {
        this.resiInte = resiInte;
//        if (resiInte!=null){
//            this.resiInteStr=((resiInte+"").split("\\."))[0];
//        }
        if (resiInte % 1.0 == 0) {
            DecimalFormat df = new DecimalFormat("#");
            this.resiInteStr = ((df.format(resiInte)).split("\\."))[0];
        } else {
            DecimalFormat df = new DecimalFormat("#.#");
            this.resiInteStr = df.format(resiInte);
        }

    }

    public Double getCurInte() {
        return curInte;
    }

    public void setCurInte(Double curInte) {
        this.curInte = curInte;
//        if (curInte!=null){
//            this.curInteStr=(curInte+"").split("\\.")[0];
//        }
        if (curInte % 1.0 == 0) {
            DecimalFormat df = new DecimalFormat("#");
            this.curInteStr = ((df.format(curInte)).split("\\."))[0];
        } else {
            DecimalFormat df = new DecimalFormat("#.#");
            this.curInteStr = df.format(curInte);
        }
    }

    public String getResiInteStr() {
        return resiInteStr;
    }

    public void setResiInteStr(String resiInteStr) {
        this.resiInteStr = resiInteStr;
    }

    public String getCurInteStr() {
        return curInteStr;
    }

    public void setCurInteStr(String curInteStr) {
        this.curInteStr = curInteStr;
    }

    public String getCreaterId() {
        return createrId;
    }

    public void setCreaterId(String createrId) {
        this.createrId = createrId;
    }

    public String getCreaterName() {
        return createrName;
    }

    public void setCreaterName(String createrName) {
        this.createrName = createrName;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getUpdaterId() {
        return updaterId;
    }

    public void setUpdaterId(String updaterId) {
        this.updaterId = updaterId;
    }

    public String getUpdaterName() {
        return updaterName;
    }

    public void setUpdaterName(String updaterName) {
        this.updaterName = updaterName;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getDelSign() {
        return delSign;
    }

    public void setDelSign(Integer delSign) {
        this.delSign = delSign;
    }

    public Integer getIsValid() {
        return isValid;
    }

    public void setIsValid(Integer isValid) {
        this.isValid = isValid;
    }

    public Integer getAuditState() {
        return auditState;
    }

    public void setAuditState(Integer auditState) {
        this.auditState = auditState;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
}
